package obj.day1.exam;

/**
 * @author げっしょく
 * @date 2021/7/15
 */
public class test01 {
    /**
     * 我们计划为一个电器销售公司制作一套系统，公司的主
     * 要业务是销售一些家用电器，例如：电冰箱、洗衣机、电视机产品。
     * 	类的设计为：
     * 冰箱类freezer
     * 属性：品牌、型号、颜色、售价
     * 行为: 存储实物storage
     * 洗衣机类washer
     * 属性：品牌、型号、颜色、售价
     * 行为:  洗衣服doSomeWashing
     * 电视类 TV
     * 属性：品牌、型号、颜色、售价
     * 行为: 看片看片seeSmallPieces
     * @param args
     */
    public static void main(String[] args) {
        freezer f = new freezer();
        f.setBrand("美的");
        f.setXingHao("双开门冰箱");
        f.setColor("白色");
        f.setPrice(5000);
        f.storage();
        washer w = new washer();
        w.setBrand("海尔");
        w.setXingHao("滚筒洗衣机");
        w.setColor("灰色");
        w.setPrice(2150);
        w.doSomeWashing();
        TV t = new TV();
        t.setBrand("LD");
        t.setXingHao("46寸大电视");
        t.setColor("黑色");
        t.setPrice(10000);
        t.seeSmallPieces();
    }
}
class TV extends DianQi{
    public TV() {
    }

    public TV(String brand, String xingHao, String color, int price) {
        super(brand, xingHao, color, price);
    }

    public String toString(){
        return "品牌："+this.getBrand()+", 型号："+this.getXingHao()+", 颜色："+this.getColor()+", 售价："+this.getPrice();
    }
    public void seeSmallPieces(){
        System.out.println(toString());
        System.out.println("看片看片");
    }
}
class washer extends DianQi{
    public washer() {
    }

    public washer(String brand, String xingHao, String color, int price) {
        super(brand, xingHao, color, price);
    }

    public String toString() {
        return "品牌：" + this.getBrand() + ", 型号：" + this.getXingHao() + ", 颜色：" + this.getColor() + ", 售价：" + this.getPrice();
    }
    public void doSomeWashing(){
        System.out.println(toString());
        System.out.println("可以用来清洗衣物");
    }
}

class freezer extends DianQi{
    public String toString() {
        return "品牌：" + this.getBrand() + ", 型号：" + this.getXingHao() + ", 颜色：" + this.getColor() + ", 售价：" + this.getPrice();
    }

    public freezer() {
    }

    public freezer(String brand, String xingHao, String color, int price) {
        super(brand, xingHao, color, price);
    }

    public void storage(){
        System.out.println(toString());
        System.out.println("存储实物");
    }
}


class DianQi{
    private String brand;
    private String XingHao;
    private String color;
    private int price;

    public DianQi() {
    }

    public DianQi(String brand, String xingHao, String color, int price) {
        this.brand = brand;
        XingHao = xingHao;
        this.color = color;
        this.price = price;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public String getXingHao() {
        return XingHao;
    }

    public void setXingHao(String xingHao) {
        XingHao = xingHao;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }
}